package com.liuzh.deviceinfo.view.togglebuttongroup.button;

import android.content.Context;
import android.widget.FrameLayout;
import c.h.a.n0.j.a;
import c.h.a.n0.j.b.b;

public abstract class CompoundToggleButton extends FrameLayout implements b {
    public boolean a;
    public boolean b;
    public a c;

    public CompoundToggleButton(Context context) {
        super(context);
        setClickable(true);
    }

    public boolean isChecked() {
        return this.a;
    }

    public boolean performClick() {
        toggle();
        return super.performClick();
    }

    public void setChecked(boolean z) {
        if (this.a != z) {
            this.a = z;
            if (!this.b) {
                post(new c.h.a.n0.j.b.a(this));
            }
        }
    }

    public void setOnCheckedChangeListener(a aVar) {
        this.c = aVar;
    }

    public void toggle() {
        if (!this.a) {
            setChecked(true);
        }
    }
}
